package b4.view
{
	import b4.model.SmartBirdExtension;
	import b4.view.component.ChatDialog;
	import b4.view.component.task.TaskDialog;
	
	import flash.events.Event;
	
	import org.aswing.event.PopupEvent;
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;

	public class TaskDialogMediator extends Mediator implements IMediator
	{
		public static const NAME:String = 'TaskDialogMediator';
		
		public function TaskDialogMediator(viewComponent:Object=null)
		{
			super(NAME, viewComponent);
		}
		
		override public function listNotificationInterests():Array
		{
			return [
			];
		}
		
		override public function handleNotification(notification:INotification):void
		{
			var name:String = notification.getName();
			var body:Object = notification.getBody();
			
			switch ( name )
			{
			}
		}
		
		override public function onRegister():void
		{
			taskDialog.show();
			taskDialog.addEventListener(PopupEvent.POPUP_CLOSED, onPopUpClosed);
		}
		
		private function onPopUpClosed(event:Event):void
		{
			facade.removeMediator(NAME);
		}
		
		override public function onRemove():void
		{
			taskDialog.dispose();
		}
		
		private function get taskDialog():TaskDialog
		{
			return viewComponent as TaskDialog;
		}
		
		private function get smartBirdExtension():SmartBirdExtension
		{
			return facade.retrieveProxy( SmartBirdExtension.NAME ) as SmartBirdExtension;
		}
	}
}